import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { WebsiteCompontRelationVO, WebsiteCompontRelationForm, WebsiteCompontRelationQuery } from '@/api/logic/websiteCompontRelation/types';

/**
 * 查询网站组件关系管理列表
 * @param query
 * @returns {*}
 */

export const listWebsiteCompontRelation = (query?: WebsiteCompontRelationQuery): AxiosPromise<WebsiteCompontRelationVO[]> => {
  return request({
    url: '/logic/websiteCompontRelation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询网站组件关系管理详细
 * @param id
 */
export const getWebsiteCompontRelation = (id: string | number): AxiosPromise<WebsiteCompontRelationVO> => {
  return request({
    url: '/logic/websiteCompontRelation/' + id,
    method: 'get'
  });
};

/**
 * 新增网站组件关系管理
 * @param data
 */
export const addWebsiteCompontRelation = (data: WebsiteCompontRelationForm) => {
  return request({
    url: '/logic/websiteCompontRelation',
    method: 'post',
    data: data
  });
};

/**
 * 修改网站组件关系管理
 * @param data
 */
export const updateWebsiteCompontRelation = (data: WebsiteCompontRelationForm) => {
  return request({
    url: '/logic/websiteCompontRelation',
    method: 'put',
    data: data
  });
};

/**
 * 删除网站组件关系管理
 * @param id
 */
export const delWebsiteCompontRelation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/logic/websiteCompontRelation/' + id,
    method: 'delete'
  });
};
